package com.codeduck.kafka.init;

import com.codeduck.kafka.config.TopicConfig;
import com.codeduck.kafka.service.AcctDetailConsumerThread;
import com.codeduck.kafka.service.ServerLogConsumerThread;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 应用启动完毕后进行必要的初始化操作
 *
 * @auther Mahone Yan
 * @date 2023/5/7
 */
@Component
public class AppInit implements ApplicationRunner {
    @Resource
    private TopicConfig topicConfig;
    @Resource
    private AcctDetailConsumerThread acctDetailConsumerThread;
    @Resource
    private ServerLogConsumerThread serverLogConsumerThread;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        // 初始化Topic
        topicConfig.init();
        // 启动交易明细消费者线程
//        acctDetailConsumerThread.start();
        // 启动日志消费者线程
//        serverLogConsumerThread.start();
    }
}
